package com.itheima.service.pmsService.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.pms.PmsMemberPrice;
import com.itheima.mapper.pmsMapper.PmsMemberPriceMapper;
import com.itheima.service.pmsService.PmsMemberPriceService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsMemberPriceServiceImpl implements PmsMemberPriceService {

    @Autowired
    PmsMemberPriceMapper pmsMemberPriceMapper;

    @Override
    public void add(PmsMemberPrice memberPrice) {
        pmsMemberPriceMapper.insert(memberPrice);
    }

    @Override
    public List<PmsMemberPrice> getInfoByBrandId(Long id) {
        LambdaQueryWrapper<PmsMemberPrice> lqw = new LambdaQueryWrapper<>();
        lqw.eq(PmsMemberPrice::getProductId,id);

        List<PmsMemberPrice> list = pmsMemberPriceMapper.selectList(lqw);
        return list;
    }

    @Override
    public void update(PmsMemberPrice memberPrice) {
        pmsMemberPriceMapper.updateById(memberPrice);
    }
}
